<div class="row toolbar">
  <div class="col-md-6">
    <span class="toolbar-header">
      <%= "#{t(:listing)} #{t(:stock_loggings)}" %>
    </span>
  </div>
  <div class="col-md-6 text-right">
    <ul class="toolbar-nav">
      <li><%= link_to feather_icon('circle-plus'), new_drug_stock_logging_path(:drug_id => "transaction") %></li>
      <li><% link_to feather_icon('trash'), new_drug_stock_logging_path(:drug_id => "transaction") %></li>
      <li><% link_to feather_icon('file-add'), new_drug_stock_logging_path(:drug_id => "transaction") %></li>
    </ul>
    <input type="text" placeholder="Search" class="search-box" />
  </div>
</div>

<table class="table table-striped">
  <thead>
    <tr>
      <th><%= t :actions %></th>
      <th><%= t :created_at %></th>
      <th><%= t :drug %></th>
      <th><%= t :inventory %></th>
      <th><%= t :quantity %></th>
      <th><%= t :stock_logging_category %></th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @stock_loggings.each do |stock_logging| %>
      <tr>
        <%= link_to "#{t(:show)}", stock_logging %>
        <%= link_to "#{t(:edit)}", edit_stock_logging_path(stock_logging) %>
        <td><%= link_to "#{t(:destroy)}", stock_logging, method: :delete, data: { confirm: 'Are you sure?' } %></td>
        <td><%= stock_logging.created_at %></td>
        <% stock_logging.drugs.each do |d| %>
        <td><%= d.name %></td>
        <% end %>
        <td><%= stock_logging.inventory.name %></td>
        <td><%= stock_logging.quantity %></td>
        <td><%= stock_logging.stock_logging_category.name %></td> 
      </tr>
    <% end %>
  </tbody>
</table>
